﻿// -----------------------------------------------------------------------
// <copyright file="Motorcycle.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex03.GarageLogic
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Motorcycle : Vehicle
    {
        private const int k_NumOfWheels = 2;
        private const float k_MaxAirPressure = 31;
        private const int k_FuelMotorCapacity = 7;
        private const float k_ElectricMotorCapacity = 2.2f;
        private eLicense m_LicenseType;
        private float m_MotorVolume;

        public Motorcycle(EnergySource.eEnergySourceType i_EnergySourceType)
            : base(k_NumOfWheels, k_MaxAirPressure)
        {
            if (i_EnergySourceType == EnergySource.eEnergySourceType.Electricity)
            {
                this.m_EnergySource = new Electric();
                this.m_EnergySource.MaxEnergyCapacity = k_ElectricMotorCapacity;
            }
            else
            {
                this.m_EnergySource = new Fueled(EnergySource.eEnergySourceType.Octan95);
                this.m_EnergySource.MaxEnergyCapacity = k_FuelMotorCapacity;
            }
        }

        public override void UpdateVehicleDetails(List<string> i_VehicleDetails)
        {
            base.UpdateVehicleDetails(i_VehicleDetails);
            this.m_LicenseType = (eLicense)Enum.Parse(typeof(eLicense), i_VehicleDetails[5]);
            this.m_MotorVolume = float.Parse(i_VehicleDetails[6]);
        }

        public override List<string> ReturnSpecialFeatures()
        {
            List<string> featuresToReturn = new List<string>();
            featuresToReturn.Add("license type (A,A1,AA,B1)");
            featuresToReturn.Add("motor volume");

            return featuresToReturn;
        }

        public override StringBuilder GetSpecialDataPrint()
        {
            StringBuilder specialDetails = new StringBuilder();
            specialDetails.Append("the motorcycle's license type is: " + this.m_LicenseType.ToString() + System.Environment.NewLine);
            specialDetails.Append("the motorcycle's motor volume is: " + this.m_MotorVolume.ToString() + " Cc's" + System.Environment.NewLine);

            return specialDetails;
        }
    }

    public enum eLicense
    {
        A,
        A1,
        AA,
        B1
    }
}
